{extend name="common/base" /}
{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="card" id="loading-box">
            <div class="card-header">
                <header class="card-title">
                    {:__('Default file')}
                </header>
            </div>
            <div class="card-body">
                <div class="table-responsive">
                    <form action="" method="post">
                        <div class="form-group">
                            <label for="Dindex">{:__('Default file suffix')}：</label>
                            <textarea name="Dindex" id="Dindex" cols="30" rows="10" class="form-control">{$files}</textarea>
                            <small class="text-muted"><span style="color:red">！</span>{:__('One per line, with priority from top to bottom.')}</small>
                        </div>

                        <div class="form-group">
                            <input type="button" value="{:__('Submit')}" class="btn btn-warning" onclick="fileUp()">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    function fileUp() {
        Dindex = $('#Dindex').val();
        if (!Dindex) {
            EchoMsg('{:__("Can not be empty")}');
            return false;
        }
        var l = $('#loading-box').lyearloading({
            opacity: 0.125,
            spinnerSize: 'lg'
        });
        $.post('{:url("index/vhost/fileUp")}', {
            Dindex: Dindex
        }, function (res) {
            EchoMsg(res.msg, 1);
        })
            .fail(function () {
                EchoMsg('{:__("Request error, please try again later")}');
            })
            .always(function () {
                l.destroy();
            })
    }
</script>
{/block}